#!/bin/bash

# CONTEXT: GUEST during CONSTRUCTION as ROOT
# PURPOSE: Install trove guest python dependencies - see trovestack functions_qemu

set -e
set -o xtrace

export DEBIAN_FRONTEND=noninteractive
apt-get --allow-unauthenticated -y install \
    libxml2-dev libxslt1-dev libffi-dev libssl-dev libyaml-dev \
    python3 python3-dev python3-pip python3-sqlalchemy python3-setuptools

# pick up the requirements file left for us by
# extra-data.d/15-reddwarf-dep

TMP_HOOKS_DIR="/tmp/in_target.d"

UPPER_CONSTRAINTS=
if [ -f ${TMP_HOOKS_DIR}/upper-constraints.txt ]; then
    UPPER_CONSTRAINTS=" -c ${TMP_HOOKS_DIR}/upper-constraints.txt"
fi

pip3 install pip==9.0.3
pip3 install wheel
pip3 install --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt ${UPPER_CONSTRAINTS}

echo "diagnostic pip freeze output follows"
pip3 freeze
echo "diagnostic pip freeze output above"
